import { Root } from 'native-base';
import React from 'react';
import { ActivityIndicator, FlatList, Image, ImageBackground, ScrollView, Text, TouchableOpacity, View } from 'react-native';
import { Icon } from 'react-native-elements';
import * as Progress from 'react-native-progress';
import { NavigationEvents } from 'react-navigation';
export default function tpl(a: <T>(action: string, ...args: unknown[]) => ((...args: unknown[]) => void), s: (...class_name: string[]) => {}, d: (data: string) => unknown) {
	const data = d('data') as { vaue_name: string, vaue: string, class_res: [{ class_id: string, class_name: string, grade: string }], d: { class_student_res: [], qj: number, yqd: number, wqd: number, zr_list: [{ class_id: string, count: number, qd: number, qj: number, class_name: string }] } };
	const display = d('display');
	const progress = d('progress') as number;
	if (data) {
		return (
			<Root>
				<View>
					<NavigationEvents
						onWillFocus={a('a001')}
					/>
					<ScrollView>
						<ImageBackground source={require('../../imgs/shouye.png')} style={{ width: '100%', height: 255 }}>
							<View style={s('shouyeTop1')}>
								<View style={{ width: 50, position: 'relative', left: -40, top: 0 }}>
									<TouchableOpacity onPress={a('a002')}>
										<Icon name="person" color="#ffffff" size={26}></Icon>
									</TouchableOpacity>
								</View>
								<TouchableOpacity onPress={a('a009')}>
									<View style={s('text1')}>
										<Text style={s('te1')}>{data.vaue_name}</Text>
									</View>
								</TouchableOpacity>
							</View>
							<View style={s('shouyeTop2')}>
								<TouchableOpacity onPress={a('a004', data.vaue)}>
									<View style={s('yuan1', 'yuan1C')}>
										<Text style={{ textAlign: 'center', color: '#f7d261', fontSize: 12, lineHeight: 20, marginTop: 20 }}><Text style={{ fontSize: 18 }}>{data.d.wqd}</Text>人</Text>
										<Text style={{ color: '#ffffff', fontSize: 9, textAlign: 'center', lineHeight: 20 }}>未签到</Text>
									</View>
								</TouchableOpacity>
								<TouchableOpacity onPress={a('a004', data.vaue)}>
									<View style={s('yuan2')}>
										<Text style={{ textAlign: 'center', color: '#91b1fd', fontSize: 12, lineHeight: 20, marginTop: 35 }}><Text style={{ fontSize: 18 }}>{data.d.yqd}</Text>人</Text>
										<Text style={{ color: '#ffffff', fontSize: 9, textAlign: 'center', lineHeight: 20 }}>已签到</Text>
									</View>
								</TouchableOpacity>
								<TouchableOpacity onPress={a('a004', data.vaue)}>
									<View style={s('yuan1', 'yuan3C')}>
										<Text style={{ textAlign: 'center', color: '#61e7f7', fontSize: 12, lineHeight: 20, marginTop: 20 }}><Text style={{ fontSize: 18 }}>{data.d.qj}</Text>人</Text>
										<Text style={{ color: '#ffffff', fontSize: 9, textAlign: 'center', lineHeight: 20 }}>请假</Text>
									</View>
								</TouchableOpacity>
							</View>
							<TouchableOpacity style={s('tz5')} onPress={a('a006')}>
								<Text style={s('tz6')}>
									签退
						</Text>
							</TouchableOpacity>
							<View style={s('top3')}>
								<Text style={s('text2')}>共计<Text>{data.d.class_student_res.length}</Text>人</Text>
							</View>
						</ImageBackground>
						<TouchableOpacity onPress={a('a005', data.vaue)}>
							<View style={s('text3')}>
								<Text style={s('vtext3')}>
									开始签到
								</Text>
							</View>
						</TouchableOpacity>
						<View style={s('zongBottom')}>
							{(() => {
								if (data.d.zr_list[0]) {

									return (<FlatList style={{}} data={data.d.zr_list} renderItem={({ item }) =>
										<View style={s('zongleft')}>
											<TouchableOpacity onPress={a('a003', item.class_id, item.class_name)}>
												<Text style={s('zongltop')}>{item.class_name}</Text>
											</TouchableOpacity>
											{(() => {
												if (item.count > 0) {
													if (item.qd === item.count) {
														return (<View style={{ position: 'absolute', top: 40 }}><Text style={s('zt1')}>全勤</Text></View>);
													}
												}
											})()}
											<View style={{ margin: 11, textAlign: 'center' }}>
												<Text style={s('zt2')}><Text style={s('color9')} >签到：</Text>{item.qd}/{item.count}</Text>
												<Text style={s('zt2')}><Text style={s('color9')} >请假：</Text>{item.qj}</Text>
											</View>
											<View style={{ flex: 1, justifyContent: 'center', flexDirection: 'row' }}>
												<TouchableOpacity onPress={a('a004', item.class_id)}>
													<View style={s('zt3')}>
														<Text style={s('zt4')}>详情</Text>
														<View style={{}}>
															<Icon name="arrow-forward" color="#4975db" size={18}></Icon>
														</View>
													</View>
												</TouchableOpacity>
											</View>
										</View>
									}
									/>);
								} else {
									return (<View style={s('page')}>
										<Image source={require('../../imgs/wushuju.png')} style={{ width: 80, height: 80 }} />
										<Text style={{ fontSize: 20, textAlign: 'center' }}>没有符合当前筛选条件的数据</Text>
									</View>);
								}
							})()}

						</View>
					</ScrollView>
				</View>
				{(() => {
					if (display) {
						return (<View style={{ backgroundColor: '#fff', opacity: 0.8, position: 'absolute', top: 0, right: 0, left: 0, bottom: 0, justifyContent: 'center', alignItems: 'center' }}>
							<View style={{ backgroundColor: '#fff', width: 300, height: 100, justifyContent: 'center', alignItems: 'center' }}>
								<Text style={{ height: 30, lineHeight: 30, fontSize: 18, marginBottom: 10 }}>上传中...</Text>
								<Progress.Bar progress={progress} width={200} />
							</View>
						</View>);
					}
				})()}
				{/*	<View style={{ position: 'absolute', top: 0, right: 0, left: 0, bottom: 0, justifyContent: 'center', alignItems: 'center' }}>
					<View style={{ backgroundColor: '#00e', width: 300, height: 50, justifyContent: 'center', alignItems: 'center' }}>
						<Text style={{ fontSize: 18, color: '#eee' }}>上传中...</Text>
					</View>
			</View>*/}
			</Root>
		);
	} else {
		return (<View style={s('footer1')}>
			<ActivityIndicator
				animating={true}
				color='blue'
				size="large"
			/>
		</View>);
	}

}
